<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>壹欧壹 - 神秘学AI探索者</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">

    <style>
        @import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital@0;1&display=swap');
        
        :root {
            --primary-purple: #5E35B1;
            --deep-purple: #4527A0;
            --mystic-blue: #1A237E;
            --tech-teal: #26A69A;
            --gold: #FFD54F;
            --dark-bg: #121212;
        }
        
        body {
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            font-family: 'Noto Sans SC', sans-serif;
            color: #e0e0e0;
        }
        
        .card-container {
            width: 375px;
            background: var(--dark-bg);
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
            position: relative;
            border: 1px solid rgba(94, 53, 177, 0.3);
        }
        
        .card-header {
            background: linear-gradient(90deg, var(--deep-purple) 0%, var(--mystic-blue) 100%);
            padding: 25px 25px 30px;
            position: relative;
            overflow: hidden;
        }
        
        .tarot-card {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 60px;
            height: 90px;
            background: linear-gradient(145deg, #1c1c3a, #0f0f1f);
            border-radius: 8px;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transform: rotate(5deg);
            border: 1px solid var(--gold);
        }
        
        .tarot-symbol {
            font-size: 28px;
            color: var(--gold);
            margin-bottom: 8px;
        }
        
        .tarot-label {
            font-size: 10px;
            text-align: center;
            color: #fff;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        
        .name-tag {
            font-family: 'Libre Baskerville', serif;
            font-size: 32px;
            font-weight: 700;
            color: var(--gold);
            margin-bottom: 5px;
            letter-spacing: 1px;
            position: relative;
            display: inline-block;
        }
        
        .name-tag::after {
            content: "";
            position: absolute;
            bottom: -5px;
            left: 0;
            width: 100%;
            height: 2px;
            background: var(--tech-teal);
            transform: scaleX(0);
            transform-origin: right;
            transition: transform 0.3s ease;
        }
        
        .location {
            display: flex;
            align-items: center;
            font-size: 14px;
            color: rgba(255, 255, 255, 0.8);
            margin-bottom: 20px;
        }
        
        .divider {
            height: 2px;
            background: linear-gradient(90deg, transparent, var(--tech-teal), transparent);
            margin: 25px 0;
        }
        
        .info-section {
            padding: 25px;
        }
        
        .section-title {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
            color: var(--tech-teal);
            font-size: 18px;
            font-weight: 700;
        }
        
        .section-title i {
            margin-right: 10px;
            font-size: 20px;
        }
        
        .info-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
            margin-bottom: 25px;
        }
        
        .info-item {
            background: rgba(30, 30, 46, 0.7);
            border-radius: 10px;
            padding: 15px;
            border: 1px solid rgba(94, 53, 177, 0.2);
            transition: all 0.3s ease;
        }
        
        .info-item:hover {
            transform: translateY(-3px);
            border-color: var(--tech-teal);
            box-shadow: 0 5px 15px rgba(38, 166, 154, 0.2);
        }
        
        .info-label {
            font-size: 12px;
            color: var(--gold);
            margin-bottom: 5px;
            font-weight: 500;
        }
        
        .info-content {
            font-size: 14px;
            font-weight: 400;
            line-height: 1.5;
        }
        
        .tag-cloud {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin: 20px 10px;
        }
        
        .tag {
            background: rgba(38, 166, 154, 0.15);
            color: var(--tech-teal);
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 12px;
            border: 1px solid rgba(38, 166, 154, 0.3);
        }
        
        .connection-section {
            background: rgba(26, 35, 126, 0.2);
            border-radius: 15px;
            padding: 20px;
            margin-top: 20px;
            border: 1px solid rgba(94, 53, 177, 0.3);
        }
        
        .connection-title {
            text-align: center;
            color: var(--gold);
            font-size: 16px;
            margin-bottom: 15px;
            font-weight: 700;
        }
        
        .connection-icons {
            display: flex;
            justify-content: space-around;
            margin-top: 20px;
        }
        
        .icon-circle {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: rgba(26, 35, 126, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            color: var(--tech-teal);
            border: 1px solid var(--tech-teal);
            transition: all 0.3s ease;
        }
        
        .icon-circle:hover {
            transform: scale(1.1) rotate(5deg);
            background: var(--tech-teal);
            color: var(--dark-bg);
        }
        
        .footer {
            padding: 20px;
            text-align: center;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.6);
            border-top: 1px solid rgba(94, 53, 177, 0.2);
        }
        
        .ai-chip {
            display: inline-flex;
            align-items: center;
            background: rgba(38, 166, 154, 0.1);
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 11px;
            color: var(--tech-teal);
            margin-top: 10px;
        }
        
        .pulse {
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(38, 166, 154, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(38, 166, 154, 0); }
            100% { box-shadow: 0 0 0 0 rgba(38, 166, 154, 0); }
        }
        
        .glow {
            text-shadow: 0 0 10px rgba(255, 213, 79, 0.7);
        }
        
    </style>
</head>
<body>

    <div class="card-container" id="business-card">
        <div class="card-header">
            <!-- 装饰性塔罗牌元素 -->
            <div class="tarot-card pulse">
                <div class="tarot-symbol">
                    <i class="fas fa-robot"></i>
                </div>
                <div class="tarot-label">AI<br>Mystic</div>
            </div>
            
            <h1 class="name-tag glow">壹欧壹</h1>
            <div class="location">
                <i class="fas fa-map-marker-alt"></i>
                <span style="margin-left: 8px;">广东 · 广州</span>
            </div>
            <p style="font-size: 14px; line-height: 1.6; max-width: 280px;">
                在数据与神秘之间架起桥梁的AI炼金术师，用代码解读未来的塔罗师
            </p>
        </div>
        
        <div class="divider"></div>
        
        <div class="info-section">
            <div class="section-title">
                <i class="fas fa-user-astronaut"></i>
                <span>探索领域</span>
            </div>
            
            <div class="info-grid">
                <div class="info-item">
                    <div class="info-label">专业核心</div>
                    <div class="info-content">
                        8年百度SEO · 神秘学领域AI应用开发
                        <span class="ai-chip">新领域</span>
                    </div>
                </div>
                
                <div class="info-item">
                    <div class="info-label">AI产品</div>
                    <div class="info-content">
                        物流AI系统 · 塔罗AI应用(简/繁/英)
                        <span class="ai-chip">即将上线</span>
                    </div>
                </div>
                
                <div class="info-item">
                    <div class="info-label">数据服务</div>
                    <div class="info-content">
                        AI数据分析代写 · SPSS/Stata/Python
                    </div>
                </div>
                
                <div class="info-item">
                    <div class="info-label">技术栈</div>
                    <div class="info-content">
                        AI编程 · Python · Cursor应用开发
                    </div>
                </div>
            </div>
            
            <div class="section-title">
                <i class="fas fa-hat-wizard"></i>
                <span>神秘学AI项目</span>
            </div>
            <div class="info-content" style="background: rgba(69, 39, 160, 0.2); padding: 15px; border-radius: 10px; border-left: 3px solid var(--gold);">
                <p style="margin-bottom: 10px;">✨ 正在开发两款塔罗AI应用，支持简/繁/英三种语言</p>
                <p>🛠️ 当前阶段：集成支付系统 & 优化登录体验</p>
            </div>
        </div>
        
        <div class="info-section">
            <div class="section-title">
                <i class="fas fa-handshake"></i>
                <span>连接与合作</span>
            </div>
            
            <div class="connection-section">
                <div class="connection-title">寻找志同道合的伙伴</div>
                <div class="info-content">
                    <p>🤝 <strong>AI应用开发者</strong> - 交流技术，碰撞商业创意</p>
                    <p>🌐 <strong>海外网络</strong> - 特别是神秘学/应用/独立站</p>
                    <p>🔮 <strong>神秘学爱好者</strong> - 探索AI+神秘学的创新应用</p>
                </div>
                
                <div class="connection-icons">
                    <div class="icon-circle">
                        <i class="fab fa-weixin"></i>
                    </div>
                    <div class="icon-circle">
                        <i class="fas fa-mail-bulk"></i>
                    </div>
                    <div class="icon-circle">
                        <i class="fab fa-github"></i>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="tag-cloud">
            <span class="tag">SEO专家</span>
            <span class="tag">AI产品开发</span>
            <span class="tag">Python编程</span>
            <span class="tag">数据分析</span>
            <span class="tag">塔罗AI</span>
            <span class="tag">独立应用</span>
        </div>
        
        <div class="footer">
            <p>微信 ou154586079 · 用AI解读未来</p>
            <p style="margin-top: 5px; font-size: 11px;">© 2023 壹欧壹 · 探索无界</p>
        </div>
    </div>

    <script>
        async function downloadCard() {
            const button = document.querySelector('.download-btn');
            const originalText = button.innerHTML;
            
            button.innerHTML = '<i class="fas fa-spinner fa-spin"></i><span>SVG生成中...</span>';
            button.disabled = true;
            
            try {
                // 等待字体加载完成
                if (document.fonts && document.fonts.ready) {
                    await document.fonts.ready;
                }

                const cardElement = document.getElementById('business-card');
                const rect = cardElement.getBoundingClientRect();
                
                // 获取所有相关的CSS样式
                const allStyles = getAllStyles();
                
                // 克隆元素以避免影响原始页面
                const clonedElement = cardElement.cloneNode(true);
                
                // 创建SVG
                const svg = createSVG(clonedElement, rect, allStyles);
                
                // 转换为图片
                await convertSVGToImage(svg, rect);
                
                button.innerHTML = '<i class="fas fa-check"></i><span>SVG下载完成</span>';
                setTimeout(() => {
                    button.innerHTML = originalText;
                    button.disabled = false;
                }, 3000); 
                
            } catch (error) {
                console.error('SVG下载失败:', error);
                // 尝试使用Canvas手动绘制作为fallback
                try {
                    await fallbackCanvasMethod();
                    button.innerHTML = '<i class="fas fa-check"></i><span>Canvas备用方案成功</span>';
                    setTimeout(() => {
                        button.innerHTML = originalText;
                        button.disabled = false;
                    }, 3000);
                } catch (fallbackError) {
                    console.error('备用方案也失败:', fallbackError);
                    button.innerHTML = `<i class="fas fa-exclamation-triangle"></i><span>下载失败</span>`;
                setTimeout(() => {
                    button.innerHTML = originalText;
                    button.disabled = false;
                }, 5000); 
                }
            }
        }
        
        function getAllStyles() {
            // 收集所有样式表的规则
            let allCSS = '';
            
            // 获取内联样式
            const styleElements = document.querySelectorAll('style');
            styleElements.forEach(style => {
                allCSS += style.textContent + '\n';
            });
            
            // 获取外部样式表（需要处理CORS问题）
            try {
                const sheets = document.styleSheets;
                for (let sheet of sheets) {
                    try {
                        if (sheet.cssRules) {
                            for (let rule of sheet.cssRules) {
                                allCSS += rule.cssText + '\n';
                            }
                        }
                    } catch (e) {
                        console.warn('无法访问样式表:', sheet.href);
                        // 对于外部CSS，我们使用内联样式作为备用
                    }
                }
            } catch (e) {
                console.warn('获取样式表时出错:', e);
            }
            
            return allCSS;
        }
        
        function createSVG(element, rect, styles) {
            // 清理元素中的绝对定位和固定定位
            const cleanedHTML = cleanElementForSVG(element);
            
            const svgContent = `
                <svg xmlns="http://www.w3.org/2000/svg" 
                     width="${rect.width}" 
                     height="${rect.height}"
                     viewBox="0 0 ${rect.width} ${rect.height}">
                    <defs>
                        <style type="text/css">
                            <![CDATA[
                                ${styles}
                                
                                /* 确保字体正确加载 */
                                @import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital@0;1&display=swap');
                                @import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');
                                
                                /* 重置一些可能导致问题的样式 */
                                * {
                                    box-sizing: border-box;
                                }
                                
                                /* 确保容器样式正确 */
                                .card-container {
                                    position: relative !important;
                                    transform: none !important;
                                }
                            ]]>
                        </style>
                    </defs>
                    <foreignObject x="0" y="0" width="100%" height="100%">
                        <div xmlns="http://www.w3.org/1999/xhtml" style="width: ${rect.width}px; height: ${rect.height}px;">
                            ${cleanedHTML}
                        </div>
                    </foreignObject>
                </svg>
            `;
            
            return svgContent;
        }
        
        function cleanElementForSVG(element) {
            // 移除可能导致SVG渲染问题的元素和属性
            const clone = element.cloneNode(true);
            
            // 移除脚本标签
            const scripts = clone.querySelectorAll('script');
            scripts.forEach(script => script.remove());
            
            // 移除可能的动画类
            const animatedElements = clone.querySelectorAll('.pulse, .glow');
            animatedElements.forEach(el => {
                el.classList.remove('pulse', 'glow');
            });
            
            // 确保所有元素都有正确的样式
            const allElements = clone.querySelectorAll('*');
            allElements.forEach(el => {
                // 移除可能导致问题的样式
                const style = el.style;
                if (style.position === 'fixed' || style.position === 'absolute') {
                    style.position = 'relative';
                }
                if (style.transform && style.transform.includes('scale')) {
                    style.transform = 'none';
                }
            });
            
            return clone.outerHTML;
        }
        
        async function convertSVGToImage(svgContent, rect) {
            return new Promise((resolve, reject) => {
                const canvas = document.createElement('canvas');
                const ctx = canvas.getContext('2d');
                const img = new Image();
                
                // 设置画布尺寸，使用更高的分辨率以获得更好的质量
                const scale = 2;
                canvas.width = rect.width * scale;
                canvas.height = rect.height * scale;
                
                // 缩放上下文以匹配高分辨率
                ctx.scale(scale, scale);
                
                img.onload = () => {
                    try {
                        // 设置透明背景以保持原始背景效果
                        ctx.clearRect(0, 0, rect.width, rect.height);
                        
                        // 绘制SVG图像
                        ctx.drawImage(img, 0, 0, rect.width, rect.height);
                        
                        // 创建下载链接
                        const dataUrl = canvas.toDataURL('image/png', 1.0);
                        const link = document.createElement('a');
                        link.download = '壹欧壹-名片-SVG方案.png';
                        link.href = dataUrl;
                        
                        document.body.appendChild(link);
                        link.click();
                        document.body.removeChild(link);
                        
                        // 创建调试预览（可选）
                        createDebugPreview(canvas, scale);
                        
                        resolve();
                    } catch (error) {
                        reject(error);
                    }
                };
                
                img.onerror = (error) => {
                    console.error('SVG图像加载失败:', error);
                    reject(new Error('SVG图像加载失败'));
                };
                
                // 将SVG转换为Data URL
                const svgBlob = new Blob([svgContent], { type: 'image/svg+xml;charset=utf-8' });
                const svgUrl = URL.createObjectURL(svgBlob);
                
                // 设置图像源
                img.src = svgUrl;
                
                // 清理URL对象
                setTimeout(() => {
                    URL.revokeObjectURL(svgUrl);
                }, 1000);
            });
        }
        
        async function fallbackCanvasMethod() {
            // Canvas手动绘制备用方案
            const cardElement = document.getElementById('business-card');
            const rect = cardElement.getBoundingClientRect();
            
            const canvas = document.createElement('canvas');
            const ctx = canvas.getContext('2d');
            
            // 设置高分辨率
            const scale = 2;
            canvas.width = rect.width * scale;
            canvas.height = rect.height * scale;
            ctx.scale(scale, scale);
            
            // 绘制背景渐变
            const gradient = ctx.createLinearGradient(0, 0, 0, rect.height);
            gradient.addColorStop(0, '#1a1a2e');
            gradient.addColorStop(1, '#16213e');
            ctx.fillStyle = gradient;
            ctx.fillRect(0, 0, rect.width, rect.height);
            
            // 绘制名片容器背景
            ctx.fillStyle = '#121212';
            ctx.beginPath();
            ctx.roundRect(0, 0, rect.width, rect.height, 20);
            ctx.fill();
            
            // 绘制header背景
            const headerGradient = ctx.createLinearGradient(0, 0, rect.width, 0);
            headerGradient.addColorStop(0, '#4527A0');
            headerGradient.addColorStop(1, '#1A237E');
            ctx.fillStyle = headerGradient;
            ctx.beginPath();
            ctx.roundRect(0, 0, rect.width, 120, [20, 20, 0, 0]);
            ctx.fill();
            
            // 绘制文本 - 需要设置字体
            ctx.fillStyle = '#FFD54F';
            ctx.font = 'bold 32px "Libre Baskerville", serif';
            ctx.fillText('壹欧壹', 25, 80);
            
            // 提示信息
            ctx.fillStyle = '#e0e0e0';
            ctx.font = '14px "Noto Sans SC", sans-serif';
            ctx.fillText('备用Canvas方案 - 简化版本', 25, 150);
            ctx.fillText('完整信息请使用浏览器打印功能', 25, 180);
            
            // 下载
            const dataUrl = canvas.toDataURL('image/png', 1.0);
            const link = document.createElement('a');
            link.download = '壹欧壹-名片-Canvas备用方案.png';
            link.href = dataUrl;
            
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
            
            // 显示预览
            createDebugPreview(canvas, scale);
        }
        
        function createDebugPreview(canvas, scale) {
            // 创建调试预览，显示生成的图像
            const existingPreview = document.getElementById('debug-preview');
            if (existingPreview) {
                existingPreview.remove();
            }
            
            const preview = canvas.cloneNode();
            const previewCtx = preview.getContext('2d');
            previewCtx.drawImage(canvas, 0, 0);
            
            preview.id = 'debug-preview';
            preview.style.position = 'fixed';
            preview.style.bottom = '10px';
            preview.style.right = '10px';
            preview.style.width = '150px';
            preview.style.height = 'auto';
            preview.style.border = '2px solid #26A69A';
            preview.style.borderRadius = '8px';
            preview.style.zIndex = '10000';
            preview.style.boxShadow = '0 4px 12px rgba(0,0,0,0.5)';
            
            document.body.appendChild(preview);
            
            // 3秒后自动移除预览
            setTimeout(() => {
                if (preview) {
                    preview.remove();
                }
            }, 5000);
        }
        
        // Canvas直接下载方案
        async function downloadWithCanvas() {
            const button = event.target.closest('.download-btn');
            const originalText = button.innerHTML;
            
            button.innerHTML = '<i class="fas fa-spinner fa-spin"></i><span>Canvas生成中...</span>';
            button.disabled = true;
            
            try {
                await fallbackCanvasMethod();
                button.innerHTML = '<i class="fas fa-check"></i><span>Canvas下载完成</span>';
            } catch (error) {
                console.error('Canvas下载失败:', error);
                button.innerHTML = '<i class="fas fa-exclamation-triangle"></i><span>Canvas下载失败</span>';
            }
            
            setTimeout(() => {
                button.innerHTML = originalText;
                button.disabled = false;
            }, 3000);
        }
        
        // 打印下载方案
        function downloadWithPrint() {
            const printWindow = window.open('', '_blank');
            const cardElement = document.getElementById('business-card');
            const styles = getAllStyles();
            
            const printContent = '<!DOCTYPE html>' +
                '<html><head><meta charset="UTF-8">' +
                '<title>壹欧壹 - 名片</title><style>' + styles +
                '@media print { body { margin: 0; padding: 20px; } ' +
                '.card-container { box-shadow: none !important; border: 1px solid #ccc !important; page-break-inside: avoid; } }' +
                '</style></head><body>' + cardElement.outerHTML +
                '<script>window.onload = function() { setTimeout(function() { window.print(); ' +
                'setTimeout(function() { window.close(); }, 1000); }, 500); }<\/script></body></html>';
            
            printWindow.document.write(printContent);
            printWindow.document.close();
        }
        
        // 添加名片悬停效果
        document.addEventListener('DOMContentLoaded', function() {
            const nameTag = document.querySelector('.name-tag');
            if (nameTag) {
                nameTag.addEventListener('mouseenter', function() {
                    this.style.transform = 'scale(1.05)';
                });
                nameTag.addEventListener('mouseleave', function() {
                    this.style.transform = 'scale(1)';
                });
            }
        });
    </script>
</body>
</html>